<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Guestbook.aspx.cs" Inherits="Guestbook" Title="The Guestbook" %>
<asp:Content ID="Content1" ContentPlaceHolderID="content1" Runat="Server">
<div style="text-align: center">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="header21p">Our Guest Book<br />&nbsp;</td>
	</tr>
	<tr>
		<td>
			<img src="images/onTheSand.jpg" alt="John and Cheryl sitting on the beach" height="200" />
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td>
			<asp:label id="lblMsg" runat="server" text="Message Label" visible="false"></asp:label>
			<asp:panel id="pnlLink" runat="server" height="100%" width="100%">
				<asp:linkbutton id="lnkShowInput" runat="server" onclick="lnkShowInput_Click" cssclass="link">Click Here</asp:linkbutton> to add your message.<br />&nbsp;
			</asp:panel>
		</td>
	</tr>
	<tr>
		<td align="left">
			<asp:panel id="pnlInput" runat="server" height="100%" width="100%" visible="false">
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td align="right" style="width: 150px">
						<asp:label id="Label2" runat="server" text="Your Name:" cssclass="header15p"></asp:label>&nbsp;
					</td>
					<td>
						<asp:textbox id="txtName" runat="server" maxlength="70" columns="20" tooltip="Enter your name here" enableviewstate="False"></asp:textbox>
						<asp:requiredfieldvalidator id="valYourName" runat="server" controltovalidate="txtName" errormessage="There must be a name to continue." setfocusonerror="True"></asp:requiredfieldvalidator></td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
				<tr>
					<td align="right" valign="top">
						<asp:label id="Label1" runat="server" cssclass="header15p" text="Message:"></asp:label>&nbsp;
					</td>
					<td>
						<asp:textbox id="txtMsg" runat="server" textmode="MultiLine" rows="10" columns="40" tooltip="Type your message to the bride and groom here." enableviewstate="False"></asp:textbox>
						<asp:requiredfieldvalidator id="valMsg" runat="server" controltovalidate="txtMsg" errormessage="<br />There must be a message to continue." setfocusonerror="True"></asp:requiredfieldvalidator></td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<br />
						<asp:button id="btnSave" runat="server" text="Save" cssclass="stdButton" onclick="btnSave_Click" />&nbsp;&nbsp;
						<asp:button id="btnCancel" runat="server" text="Cancel" usesubmitbehavior="false" cssclass="stdButton" onclick="btnCancel_Click" causesvalidation="False" />
					</td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
			</table>
			</asp:panel>
		</td>
	</tr>
	<tr>
		<td>
			<asp:panel id="pnlMsgs" runat="server" height="100%" width="100%">
			<asp:repeater id="rptMessages" runat="server" datasourceid="GuestBookDataSource">
				<headertemplate>
					<table cellpadding="0" cellspacing="0" border="0" width="100%">
				</headertemplate>
				<itemtemplate>
					<tr>
						<td align="left" class="header15p">
							From: <%# Eval("Name") %> - <span class="header13p"><%# Eval("DatePosted", "{0:d}")%></span>
						</td>
					</tr>
					<tr>
						<td align="left"><%# Eval("Message").ToString().Replace("\n", "<br />") %></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
				</itemtemplate>
				<alternatingitemtemplate>
					<tr class="bkgd-lightpurple">
						<td align="left" class="header15p">
							From: <%# Eval("Name") %> - <span class="header13p"><%# Eval("DatePosted", "{0:d}")%></span>
						</td>
					</tr>
					<tr class="bkgd-lightpurple">
						<td align="left"><%# Eval("Message").ToString().Replace("\n", "<br />") %></td>
					</tr>
					<tr class="bkgd-lightpurple">
						<td>&nbsp;</td>
					</tr>
				</alternatingitemtemplate>
				<footertemplate>
					</table>
				</footertemplate>
			</asp:repeater>
			<asp:objectdatasource id="GuestBookDataSource" runat="server" oldvaluesparameterformatstring="original_{0}" selectmethod="GetAllMessages" typename="WeddingDBTableAdapters.MessagesTableAdapter" insertmethod="Insert">
				<insertparameters>
					<asp:parameter name="Name" type="String" />
					<asp:parameter name="Message" type="String" />
					<asp:parameter name="DatePosted" type="DateTime" defaultvalue="DateTime.Now" />
				</insertparameters>
			</asp:objectdatasource>
			</asp:panel>
		</td>
	</tr>
</table>
</div>
</asp:Content>

